package com.sunsy.authserver.beans.vo;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * (UniformUser)表展示类
 *
 * @author makejava
 * @since 2021-07-20 14:40:39
 */
@Data
public class AdminUserVO implements Serializable {

    private Long id;
    /**
     * 对接第三方系统使用的ID
     */
    private String openId;

    /**
     * 自定义的登陆账号
     */
    private String account;

    /**
     * 用户真实姓名
     */
    private String username;

    /**
     * 手机号,可以国家编号
     */
    private String mobile;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 账号状态-外部表
     */
    private String statusName;

    private Integer status;

    /**
     * 所属部门
     */
    private String dept;

    /**
     * 创建人
     */
    private String createdBy;

    /**
     * 后期对接微信扫码登陆
     */
    private String wechatId;

    /**
     * 后期对接qq登陆
     */
    private String tencentId;

    /**
     * 后期可以对接新浪登陆
     */
    private String sinaId;

    /**
     * 域账号-只有内部员工有
     */
    private String domainAccount;

    private String type;

    private String tenant;
    private String appName;
    private Date expirationDate;
    private Date expirationEnd;
    private Date createdTime;
    private Date updatedTime;

    public String getCreatedTime() {
        return this.createdTime!=null  ? new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createdTime):"-";
    }

    public String getUpdatedTime() {
        return this.updatedTime!=null  ? new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updatedTime):"-";
    }

    public String getExpirationDate() {
        return this.expirationDate!=null  ? new SimpleDateFormat("yyyy-MM-dd").format(this.expirationDate):"-";
    }

    public String getExpirationEnd() {
        return this.expirationEnd!=null  ? new SimpleDateFormat("yyyy-MM-dd").format(this.expirationEnd):"-";
    }

    public void setTenant(String tenant) {
        if (StringUtils.isBlank(this.tenant)){
            this.tenant=tenant;
        }else{
            this.tenant+=","+tenant;
        }
    }

    public void setAppName(String appName) {
        if (StringUtils.isBlank(this.appName)){
            this.appName=appName;
        }else{
            this.appName+=","+appName;
        }
    }

    private boolean checked;
}